<include file="Public/head"/>
<body class="no-skin">
<include file="Public/header"/>
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>

    <include file="Public/sidebar"/>
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <include file="Public/breadcrumbs"/>

            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">
                <include file="Public/set"/>

                <!-- /section:settings.box -->
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <iframe name="goods_execl_file" style="display:none;"></iframe>

                        <form class="form-horizontal"  target="goods_execl_file"  action="{:U('ajaxupload')}"  method="post"  enctype="multipart/form-data">
                            <div class="form-group">
                                <label class="col-sm-1 control-label no-padding-right" for="form-field-1"> 文件 </label>
                                <div class="col-sm-9">
                                    <input type="file" name="files" id="filename"   class="rcol-xs-10 col-sm-5" />                                 
                                </div>
                            </div>

                        </form>
                        <div class="clearfix"></div>
                        <div class="space-4"></div>

                        <form class="form-horizontal" action="{:U('uplode')}" name="myfromSubmitss" method="post"  enctype="multipart/form-data">

                            <div class="form-group">
                                <label class="col-sm-1 control-label no-padding-right" for="form-field-1"> 操作批次号 </label>
                                <div class="col-sm-9">
                                    <input type="text" name="ponum" id="ponum"   class="rcol-xs-10 col-sm-5" /> 
                                </div>
                            </div>
                            
                            <input type="hidden" name="filepath" id="filepath"   class="rcol-xs-10 col-sm-5" /> 
                                
                            <div class="form-group">
                                <label class="col-sm-1 control-label no-padding-right" for="form-field-1"> 字段对应 </label>
                                <div class="col-sm-9">
                                    <table class="table" id="fieldtable">
                                        <tr><td>数据库字段</td><td>excel字段</td></tr>
                                    </table>
                                </div>
                            </div>

                            <div class="space-4"></div>

                            <div class="space-4"></div>
                            <div class="col-md-offset-2 col-md-9">
                                <button class="btn btn-info" type="submit">
                                    <i class="icon-ok bigger-110"></i>
                                    提交
                                </button>

                                &nbsp; &nbsp; &nbsp;
                                <button class="btn" type="reset">
                                    <i class="icon-undo bigger-110"></i>
                                    重置
                                </button>
                            </div>
                        </form>
                        <!-- PAGE CONTENT ENDS -->
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div><!-- /.page-content -->
        </div>
    </div><!-- /.main-content -->
    <include file="Public/footer"/>

</div><!-- /.main-container -->

<include file="Public/footerjs"/>
<!-- inline scripts related to this page -->
<script src="__PUBLIC__/qwadmin/js/date-time/bootstrap-datepicker.js"></script>

<!--<script src="__PUBLIC__/qwadmin/js/function.js"></script>-->
<script>
var title = '';
var code  = '';
$(function(){
                            
   $("#filename").change(function(){
        swal({
                title: "",
                text: '<div class="sk-spinner sk-spinner-three-bounce"><div class="sk-bounce1"></div><div class="sk-bounce2"></div><div class="sk-bounce3"></div></div>',
                html: true,
                showConfirmButton: false 
        });
        $(this).closest('form').submit();
   });
});

function tips_msg() {
 swal({
     title: "",
     text: title,
     type : code,
     html: true
 });
}
function uplaodback(data){
    $("#filepath").val(data.filepath);
//    console.log(data);
    var str="";
    var strdatabase="";
    var strexcelfield="";
    $.each(data.databasefilds,function(item){
        str+="<tr><td><select name=fmap["+item+"][0]><option value=''>请选择</option>";
        $.each(data.databasefilds,function(ii){
            str+="<option value='"+data.databasefilds[ii][0]+"'>"+data.databasefilds[ii][1]+"</option>";   
        });
        str+="</select>";        
        str+="</td><td>";
        str+="<select name=fmap["+item+"][1]><option value=''>请选择</option>";
        $.each(data.excelfield,function(ii){
            str+="<option value='"+data.excelfield[ii][0]+"'>"+data.excelfield[ii][1]+"</option>";
        });
        str+="</select>";        
        
        str+="</td></tr>";
    });
    $('#fieldtable').append(str);
    
}

</script>
</body>
</html>
